<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>0</h1>
<!--定时器:在浏览器页面中实现计时的功能-->
<!--setTimeout()  获取时间&#45;&#45;&#45;&#45;秒;-->
<script>
    setTimeout(1000);
    let count = 10;
let h1 = document.querySelector("h1");
//setTimeout()//开启值执行一次的定时器
let timer = setInterval(f,1000);
function f() {
    count--;
    h1.innerText = count;
if (count==0){
    //停止计时器
    clearInterval(timer);

}
}
</script>
</body>
</html>